package com.example.onlineeducation.repository

import com.example.onlineeducation.data.json.VersionJson
import com.example.onlineeducation.net.ApiService
import com.yc.jetpacklib.base.YcRepository
import com.yc.jetpacklib.extension.ycFlow
import com.yc.jetpacklib.net.YcResult
import kotlinx.coroutines.flow.Flow
import ycGetDataNoNull

/**
 * Creator: sindi
 * Date: 2022/01/05
 * UseDes:
 */
class VersionRepository(private val apiService: ApiService) : YcRepository() {
    /**
     * 版本更新
     */
    fun getVersion(): Flow<YcResult<VersionJson>> = ycFlow {
        val json = apiService.getVersion().ycGetDataNoNull()
        send(YcResult.Success(json))
    }
}